/*
 * @Author: 黑白灰01 3193273703@qq.com
 * @Date: 2025-09-01 14:54:44
 * @LastEditors: 黑白灰01 3193273703@qq.com
 * @LastEditTime: 2025-09-01 15:19:54
 * @FilePath: /hei-oa/src/common/dto/pagination.dto.ts
 * @Description: 这是默认设置,请设置`customMade`, 打开koroFileHeader查看配置 进行设置: https://github.com/OBKoro1/koro1FileHeader/wiki/%E9%85%8D%E7%BD%AE
 */
// src/common/dto/pagination.dto.ts
import { IsNumber, IsOptional, Min, IsPositive } from 'class-validator';
import { Type } from 'class-transformer';
import { ApiProperty } from '@nestjs/swagger';

export class PaginationDto {
  @ApiProperty({
    required: false,
    description: '页码，默认为1',
    default: 1,
  })
  @IsOptional()
  @Type(() => Number)
  @IsNumber()
  @Min(1)
  @IsPositive()
  page: number = 1;

  @ApiProperty({
    required: false,
    description: '每页记录数,默认为10',
    default: 10,
  })
  @IsOptional()
  @Type(() => Number)
  @IsNumber()
  @Min(1)
  @IsPositive()
  pageSize: number = 10;

  @ApiProperty({
    required: false,
    description: '搜索关键字',
  })
  @IsOptional()
  keyword?: string;

  @ApiProperty({
    required: false,
    description: '排序字段',
  })
  @IsOptional()
  sortBy?: string;

  @ApiProperty({
    required: false,
    description: '排序方向 (ASC/DESC)',
    enum: ['ASC', 'DESC'],
  })
  @IsOptional()
  sortDirection?: 'ASC' | 'DESC';
}